import React, { component } from 'react'
import { Table, Pagination } from 'antd'
import style from './TableList.less'

const columns = [
    {
        title: '会员名称',
        dataIndex: 'name',
        key: '1',
    },
    {
        title: '时间',
        dataIndex: 'time',
        key: '2'
    },
    {
        title: '数量',
        dataIndex: 'money',
        key: '3',
        render: text => {
            return (
                <span>{text ? text : "0"}</span>
            )
        }
    }
]
export default class TableList extends React.Component {

    render() {
        const { RehargeItem, loading, page } = this.props
        const { content, totalElements } = RehargeItem
        return (
            <div className={style.charge_list}>
                <div className={style.TableList}>
                    <Table bordered rowKey={record => record.id}
                        columns={columns}
                        dataSource={content}
                        loading={loading}
                        pagination={false} />
                </div>
                <div className={style.pagesize}>
                    <Pagination defaultCurrent={1} current={page} onChange={this.props.onHandlePage} total={totalElements ? Number(totalElements) : 1} />
                </div>
            </div>
        )
    }
}